/*
    页面跳转
    页面右上角 用户名修改
*/
var k = GetQueryString("k") || ""; //是否要跳转到上一页
var b = GetQueryString("b") || ""; //是否需要自动登录

$(document).ready(function() {
    // localStorage.clear(); //清除localstorage
    if (!window.applicationCache) {//浏览器不支持HTML5 跳转到浏览器不支持页面
        // alert("你的浏览器不支持HTML5");
        jump('error.html')
    }
    
    var originUrl = window.location.origin + '/';
    if(window.location.href == originUrl && !localStorage["RKname"] && !localStorage["RKpass"]) { //如果地址为域名、且localstorage不存在时，跳转到登录页面
        if(localStorage["RKlazy"]) {//自动登录
            jump('login.html?b=2')
        }else { //普通登录
            jump('login.html?b=1')
        }
        
    }
})
function jump(page) {
    window.location.href = page;
    coursor: pointer;
}
function BackPage(){
    window.history.go(-1);
}
//返回上一页并刷新
function backpage(){
    javascript: history.go(-1); location.reload();
}
//获取url参数
function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var result = window.location.search.substr(1).match(reg);
    return result ? decodeURIComponent(result[2]) : null;
}

var RKname = localStorage["RKname"];
var RKpass = localStorage["RKpass"];
var RKlazy = localStorage["RKlazy"];

$('.username').html(RKname + ' !');